package com.tjetc.service;

import com.tjetc.dao.FanDao;
import com.tjetc.domain.Fan;
import com.tjetc.domain.Person;

import java.sql.SQLException;

public class FanService {
    private FanDao fanDao=new FanDao();
    public Person log(String username, String password) {
        try {
            return fanDao.log(username,password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    public Fan findByFanId(int fanId) {
        try {
            return fanDao.fandByFanId(fanId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    public boolean del(int fanId) {
        try {
            return fanDao.del(fanId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }

    public boolean updateUsername(String newUsername,int fanId) {
        try {
            return fanDao.fanUpdateUsername(newUsername,fanId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }

    public boolean updatePassowrd(String newdate, int fanId) {//新数据 ，fanId，改的数据类型
        try {
            return fanDao.fanupdatePassowrd(newdate,fanId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }

    public boolean updateName(String newName, int fanId) {
        try {
            return fanDao.fanupdateName(newName,fanId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }

    public boolean updatePhone(String newPhone, int fanId) {
        try {
            return fanDao.fanupdatePhone(newPhone,fanId);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }
}
